class Stack:
    def __init__(self):
        self.items = []

    def isEmpty(self):
        return  self.items == []

    def push(self,item):
        self.items.append(item)

    def pop(self):
        return self.items.pop()

    def peek(self):
        return self.items[len(self.items)-1]

    def size(self):
        return len(self.items)

def dtob(decNumber,base):
    s = Stack()
    rem = 0
    dit16 = "0123456789ABCDEF"
    while decNumber >0:
        #get %
        rem = decNumber % base
        decNumber = decNumber // base
        s.push(rem)
    b_string = ""

    while not s.isEmpty() :
        b_string = b_string + str(dit16[s.pop()])
    return b_string

print(dtob(42,16))
